<template>
  <el-card>
    <div class="page-tools">
      <!--
        如果left插槽，不传递内容，左侧内容tips应该不渲染
        知识点：this.$slots 可以拿到所有的插槽列表信息
        this.$slots.left  具名插槽left的内容
        this.$slots.right 具名插槽right的内容
      -->
      <!-- 左侧 -->
      <div class="left">
        <div v-if="$slots.left" class="tips">
          <i class="el-icon-info" />
          <slot name="left" />
        </div>
      </div>
      <!-- 右侧 -->
      <div class="right">
        <slot name="right" />
      </div>
    </div>
  </el-card>
</template>

<script>
export default {
  created() {
    // console.log(this.$slots)
  }
}
</script>

<style lang="scss" scoped>
.el-card {
  margin-bottom: 10px;
}
.page-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  .tips {
    height: 34px;
    line-height: 34px;
    padding: 0 20px;
    border-radius: 5px;
    background-color: #e6f7ff;
    border: 1px solid #9dd9ff;
    i {
      color: #3673f4;
      margin-right: 10px;
    }
  }
}
</style>
